 <!--header start-->
      <header class="header white-bg">
            <div class="headerToggBtn">
              <!-- <div class="sidebar-toggle-box"><div data-original-title="点击收放" data-placement="right" class="icon-reorder tooltips"></div></div> -->
              {$date.m}月{$date.d}日 星期{$arr[$date['w']]}
            </div>
            <div class="headerLogoBox">
              <!--logo start-->
                <a class="logo"><img src="__PUBLIC__/images/logo.png" /></a>
              <!--logo end-->
            </div>
            
            
            <div class="nav notify-row" id="top_menu">
                
            </div>
            <div class="top-nav">
                <!--search & user info start-->
                <ul class="nav pull-right top-menu">
                    <li class="dropdown dropdown-project">
                        <a data-toggle="dropdown" class="dropdown-toggle headerGreenBtn">
                          <i class="glyphicon glyphicon-align-justify"></i>                       
                            <if condition="$_SESSION['pname'] neq ''">
                                <span class="username" id="swit">{$admin_info.pname}</span>
                            <else/>
                                <span class="username">切换项目</span>
                            </if>
                            <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu extended" style="top:50px;">
                            <div class="log-arrow-up"></div>
                            <if condition="$project neq '' && $project neq 'null'">
                                <foreach name="project" item="v" key="k">
                                    <li onclick="swit({$v.id},'{$v.name}')"><a href="#"><i class="icon-{:$v['total_ren'] == $_SESSION['admin_id'] ? 'user' :'file'}"></i>{$v.name}</a></li>
                                </foreach>
                            <else/>
                                <li><a href="#"><i class="icon-file"></i>没有可切换的项目</a></li>
                            </if>
                        </ul>
                    </li>
                    <!-- user login dropdown start-->
                    <li class="dropdown">
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                            <!-- <img style="float: left;" alt="" src="{$img.img}" width="29" height="29"> -->
                            <if condition="$admin_info['role'] eq 4 || $admin_info['role'] eq 1">
                            	   <i class="UserIcon UserIcon_1">
                            </if>
                            <if condition="$admin_info['role'] eq 3">
                           		   <i class="UserIcon UserIcon_2">
                            </if>
                            <if condition="$admin_info['role'] eq 5">
                            	   <i class="UserIcon UserIcon_3">
                            </if>
                                 </i>
                            <span class="username BuildingCreditUsername">
                                <span>{$admin_info.name}</span>
                                <b class="caret"></b>
                            </span>                           
                        </a>
                        <ul class="dropdown-menu extended logout">
                            <div class="log-arrow-up"></div>
                            <li><a href="{:U('/System/cleanCache')}" onclick="return confirm('确定清除缓存吗？')"><i class=" icon-trash"></i>清除缓存</a></li>
                            <li><a href="{:U('Admin/editpwd')}" target="rightContent"><i class="icon-key"></i>修改密码</a></li>
                            <!-- <li><a href="{:U('Admin/upload')}" target="rightContent"><i class="icon-upload-alt"></i> 文件上传</a></li> -->
                            <li><a href="/Admin/logout"><i class="icon-power-off"></i>安全退出</a></li>
                        </ul>                  
                    </li>
                    <!-- user login dropdown end -->
                </ul>
                <!--search & user info end-->
            </div>
        </header>
      <!--header end-->
<script src="__PUBLIC__/js/jquery.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    //重点，每隔一段时间去服务器获取数据
    //window.setInterval("getMsg()",30000);
  function getMsg(){
    ajaxmes();
  }  
  $(document).ready(function(){
    ajaxmes();
  });
	// ajax 抓取页面
	function ajaxmes(){
    $.ajax({
        type : "POST",
        url:'/Index/ajaxmes',
        success: function(data){
        	if(data.status==0){
						layer.alert(data.info, {icon: 2});
						return;
					}
          $("#top_menu").html('');
          $("#top_menu").append(data);
        }
    });
	}    
  function deta(o){
	   var bb = $("#msg").text() - 1;
			  if(bb<=0){
				  bb="";
			  }
			  $("#msg").text(bb);
		$(o).remove();
  }
  function swit(obj,name){
	// var url = parent.document.getElementById("rightContent").contentWindow.location.href;
	  if(obj){
			layer.confirm('确定更换'+ name +'项目吗?', {
	     		btn: ['确定','取消'] //按钮
	    }, function(){
   			$.ajax({
   	          type : "POST",
   	          url:'__URL__/swit',
   	          data : {pid:obj,name:name},
   	          dataType : 'json',
   	          success: function(res){
   	        	  if(res.status==0){
       						  layer.alert(res.info, {icon: 2});
       						  return;
       				  }
       		 			  if(!res.errNo){
         		 				  layer.msg('切换成功',{icon:1});
         		 				  $('#swit').text(res.msg);
         		 			　　rightContent.location.reload();        
         			    }else{
         			        layer.msg(res.msg,{icon:1});
       			      }
   	          }
     	  });
	    }, function(){
	    			// 取消
	    });
	    return false;
	  }
  }
</script>
